{include file="public/head" /}
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>直付通管理</cite></a>
        <a><cite>账单列表</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
       <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so"  method="get" action="{:url('index')}" >
          <input class="layui-input" placeholder="二级商户" name="community_name" id="community_name" {if isset($community_name)}value="{$community_name}"{/if}>
          <input class="layui-input" placeholder="系统订单号" name="out_trade_no" id="out_trade_no" {if isset($out_trade_no)}value="{$out_trade_no}"{/if}>

            <input class="layui-input" placeholder="交易单号" name="trade_no" id="trade_no" {if isset($trade_no)}value="{$trade_no}"{/if}>
            <input class="layui-input" placeholder="订单金额" name="pay_money" id="pay_money" {if isset($pay_money)}value="{$pay_money}"{/if}>

            <div class="layui-input-inline" style="width:100px">
                <select name="settle_status"  style="width:90px">
                    <option value="">结算状态</option>
                    <option value="1" {if isset($settle_status)}{if $settle_status == '1'}selected{/if}{/if}>已结算</option>
                    <option value="0" {if isset($settle_status)}{if $settle_status == '0'}selected{/if}{/if}>未结算</option>
                </select>
            </div>
          <div class="layui-input-inline" style="width:150px">
            <input class="layui-input" placeholder="开始时间" name="start_time" id="start" {if isset($start_time)}value="{$start_time}"{/if} style="width:140px">
          </div>
          <div class="layui-input-inline" style="width:150px">
            <input class="layui-input" placeholder="结束时间" name="end_time" id="end" {if isset($end_time)}value="{$end_time}"{/if}  style="width:140px">
          </div>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
          <button class="layui-btn layui-btn-danger" onclick="billExportExcel('{$export}')"><i class="layui-icon"></i>批量导出</button>
          <span class="x-right" style="line-height:40px"> 订单金额：{$money} </span>
        <span class="x-right" style="line-height:40px">  共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table" id="table">
        <thead  style="text-align:center;">
          <tr>
            <th style="text-align: center; font-size: 16px;">id</th>
            <th style="text-align: center; font-size: 16px;">二级商户</th>
            <th style="text-align: center; font-size: 16px;">收款码名称</th>
            <th style="text-align: center; font-size: 16px;">订单金额</th>
            <th style="text-align: center; font-size: 16px;">系统订单号</th>
            <th style="text-align: center; font-size: 16px;">支付宝订单号</th>
            <th style="text-align: center; font-size: 16px;">支付时间</th>
            <th style="text-align: center; font-size: 16px;">回调时间</th>
             <th style="text-align: center; font-size: 16px;">userid</th>
            <th style="text-align: center; font-size: 16px;">结算状态</th>
            <th style="text-align: center; font-size: 16px;">操作</th>
          </tr>
        </thead>
        <tbody style="text-align:center;">
            {foreach $list as $lis}
            <tr>
              <td style="text-align: center;">{$lis.uid}</td>
              <td style="text-align: center;">{$lis.community_name}</td>
              <td style="text-align: center;">{$lis.gate_name}</td>
              <td style="text-align: center;">{$lis.order_money}</td>
                <td style="text-align: center;">{$lis.out_trade_no}</td>
                <td style="text-align: center;">{$lis.trade_no}</td>
              <td style="text-align: center;">{$lis.create_time}</td>
              <td style="text-align: center;">{$lis.notify_time}</td>
              <td style="text-align: center;">{$lis.user_id}</td>
              <td style="text-align: center;">
                {if $lis.settle_status == "0"}
                未结算
                {else if $list.settle_status == "1"}
                已结算
                {/if}
              </td>

              <td class="td-manage" style="text-align: center;">

<!--                <a onclick="payurl('{$lis.id}')" title="缴费链接" href="javascript:;">-->
<!--                  <i class="layui-icon">&#xe628; </i>-->
<!--                </a>-->
<!--                -->
                {if $lis.settle_status == "0"}
                <a title="结算"  onclick="x_admin_show('结算','{:url(\'doSettle\')}?id={$lis.uid}',550,500)" href="javascript:;">
                    <i class="layui-icon">&#xe60f;</i>
                </a>
                {/if}
              </td>
            </tr>
            {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div id="page">
          {$list->render()|raw}
        </div>
      </div>

    </div>
    <script>
      function payurl(id){
        layer.open({
          type: 1,
          skin: 'x-right', //样式类名
          closeBtn: 0, //不显示关闭按钮
          anim: 2,
          shadeClose: true, //开启遮罩关闭
          area: ['80%', '300px'],
          content:
                  '<div style="padding: 20px 100px; font-size:18px">'+
                  '支付宝小程序缴费：https://www.zaozaopay.com/pages/zft/pay?id='+ id + '<br><br>'+


                  '</div>'
        });
      }
      layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
          elem: '#start', //指定元素
          type:'datetime',
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
          ,type:'datetime',
        });
      });

      function billExportExcel(exportid){
          var datas = $('#table tbody td .layui-form-checked')
          var ids = []
          datas.each(function(index, element){
              var id = $(this).data('id')
              ids.push(id)
          })

          var str = ids.join(',');
          var count = ids.length
          var url = "{:url('orderExport')}?id=" + str +'&export=' + exportid
          console.log(url);
          layer.open({
              type: 2,
              title: '批量导出账单',
              shadeClose: true,
              shade: 0.8,
              area: ['80%', '95%'],
              content: url //iframe的url
          });
      }

    </script>

    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

  </body>

</html>